$html: (
  'height': 300px,
);

@include b(html) {
  @include set-component-css-var('html', $html);

  display: inline-block;
  width: 100%;
  height: 100%;

  @include b(html-content) {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: #{getCssVar(color, bg, 0)};
  }

  @include b(html-editor) {
    height: getCssVar('html', 'height') !important;
    padding: 0;
    overflow-y: scroll;
    border: 1px solid getCssVar(color, border);
  }

  --w-e-textarea-bg-color: #{getCssVar(color, bg, 1)};
  --w-e-textarea-color: #{getCssVar(color, text, 2)};
  --w-e-textarea-border-color: #{getCssVar(color, border)};
  --w-e-textarea-slight-border-color: #{getCssVar(color, border)};
  --w-e-textarea-slight-color: #{getCssVar(color, text, 1)};
  --w-e-textarea-slight-bg-color: #{getCssVar(color, bg, 1)};
  --w-e-textarea-selected-border-color: #{getCssVar(color, border)};
  --w-e-textarea-handler-bg-color: #{getCssVar(color, primary)};
  --w-e-toolbar-color: #{getCssVar(color, text, 0)};
  --w-e-toolbar-bg-color: #{getCssVar(color, bg, 1)};
  --w-e-toolbar-active-color: #{getCssVar(color, text, 0)};
  --w-e-toolbar-active-bg-color: #{getCssVar(color, bg, 1)};
  --w-e-toolbar-disabled-color: #{getCssVar(color, disabled, text)};
  --w-e-toolbar-border-color: #{getCssVar(color, border)};
  --w-e-modal-button-bg-color: #{getCssVar(color, bg, 1)};
  --w-e-modal-button-border-color: #{getCssVar(color, border)};

  .w-e-menu-tooltip-v5::before {
    color: #{getCssVar(color, text, 0)};
    background-color: var(--w-e-toolbar-bg-color);
  }

  .w-e-full-screen-container {
    z-index: 9999;
  }

  .w-e-scroll {
    >div {
      background-color: getCssVar(color, bg, 0);
    }
  }

  .table-container {
    table {
      width: 100%;
    }
  }
}

.rich-html-table {
  width: 100% !important;
  border-collapse: collapse;

  th {
    height: 49px;
    min-height: 49px;
    padding: 8px;
    background-color: #F3F3F3;
    border: 1px solid lightgray;
  }

  td {
    height: 49px;
    min-height: 49px;
    padding: 8px;
    empty-cells: show;
    border: 1px solid lightgray;
  }
}

@include b('html-editor-readonly') {
  @include b('html-toolbar') {
    display: none;
  }

  @include b('html-editor') {
    border: none;
  }
}

@include b('html-footer') {
  display: flex;
  align-items: center;
  justify-content: end;
  margin-top: 12px;
  margin-right: 8px;

  &>*+* {
    margin-left: 16px;
  }


  @include e('cancel') {
    height: 36px;
    line-height: 36px;
    color: #{getCssVar(color, text, 1)};
    cursor: pointer;
    opacity: 0.7;

    &:hover {
      color: #{getCssVar(color, primary)};
      opacity: 1;
    }
  }

  @include e('save') {
    width: 96px;
    height: 36px;
    line-height: 36px;
    color: #{getCssVar(color, primary, active, text)};
    text-align: center;
    cursor: pointer;
    background-color: #{getCssVar(color, primary)};
    border-radius: 5px;

    &:hover {
      box-shadow: 0 2px 5px 1px #{getCssVar(color, primary)};
    }
  }
}

@include b('html-custom-toolbar') {
  display: flex;
  align-items: center;
  justify-content: end;
  width: 100%;
  height: 32px;
  padding-right: 16px;
  font-size: 16px;

  &>*+* {
    margin-left: 20px;
  }

  i {
    cursor: pointer;

    &:hover {
      color: #{getCssVar(color, primary)};
    }
  }
}

@include b('html-message') {
  width: 500px;
  max-width: unset;

  @include e('message-content') {
    @include m('message-tip') {
      color: #{getCssVar(color, text, 3)};
    }
  }

  @include e('message-cancel') {
    color: #{getCssVar(color, text, 1)};
    background-color: transparent;

    &:hover {
      color: #{getCssVar(color, primary)};
      background-color: transparent;
    }
  }

  @include e('message-comfire') {
    background-color: #{getCssVar(color, danger)} !important;

    &:hover {
      box-shadow: 0 2px 5px 1px #{getCssVar(color, danger)};
    }
  }
}

@include b('html-dialog-full-screen') {
  height: 80%;

  @include b('html') {
    padding: 0 32px;

    --w-e-toolbar-bg-color: #{getCssVar(color, bg, 0)};
  }

  @include b('html-custom-toolbar') {
    height: 56px;
  }

  @include b('html-content') {
    height: calc(100% - 124px);

    @include b('html-editor') {
      height: 100% !important;
    }
  }
}

@include b('html-footer-dialog') {
  height: 68px;
  margin-top: 0;
}